package com.shujia.day17;

public class Demo09Enum {
    public static void main(String[] args) {
        GenderEnum.Gender man1 = GenderEnum.MAN;
        GenderEnum.Gender man2 = GenderEnum.MAN;
        System.out.println(man2);
        System.out.println(man1);
        man2.skill();

        GenderE MAN1 = GenderE.MAN;
        GenderE MAN2 = GenderE.MAN;
        System.out.println(MAN1);
        System.out.println(MAN2);
        MAN1.skill();

        GenderE WOMEN = GenderE.WOMEN;
        WOMEN.skill();

    }
}




class GenderEnum{
    // 给定两个全局唯一的静态常量
    static final Gender MAN = new Gender() {
        @Override
        public void skill() {
            System.out.println("负责对外工作");
        }
    };

    static final Gender WOMEN = new Gender() {
        @Override
        public void skill() {
            System.out.println("负责家庭生活");
        }
    };

    static interface Gender{
        void skill();
    }
}